//
//  orderDetailViewController.m
//  XDBaseFrameWork
//
//  Created by xindao on 14-9-26.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//




#import "orderDetailViewController.h"
#import "RTLabel.h"
#import "orderDetailModel.h"

#import "DownLoadViewController.h"
#import "WuLiuViewController.h"
#import "ChooseImageRootViewController.h"
#import "PayByBagViewController.h"

//支付宝客户端头文件
#import "DataSigner.h"
#import "AlixPayResult.h"
#import "DataVerifier.h"
#import "AlixPayOrder.h"
#import "PartnerConfig.h"
#import "AlixLibService.h"
//
//
//

#import "ChooseTaoCanViewController.h"


@interface orderDetailViewController ()
{
    NSString * IsAuthen;
}
@end

@implementation orderDetailViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)viewOrderRecorder{
    WuLiuViewController * recorder = [[WuLiuViewController alloc] init];
    recorder.orderCode= orderDetailData.OrderCode;
    recorder.orderID = self.orderID;
    recorder.cameraManName = orderDetailData.EmplName;
    [self.navigationController pushViewController:recorder animated:YES];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.titleLabel.text = @"订单状态";
    self.leftBtn.hidden = NO;
    IsAuthen = [[NSString alloc] init];
    float h = 0;
    if (IOS7) {
        h = 20;
    }
//    
//    UIButton * rightBtn = [UIButton initButton:CGRectMake(UI_SCREEN_WIDTH-70, h, 70, UI_NAVIGATION_BAR_HEIGHT) btnNorImage:nil btnHighlightImage:nil btnTitle:@"订单记录" titleColor:self.titleLabel.textColor titleFont:[UIFont systemFontOfSize:14]];
//    [rightBtn addTarget:self action:@selector(viewOrderRecorder) forControlEvents:UIControlEventTouchUpInside];
//    [self.navigationBarView addSubview:rightBtn];
    
    self.contentView.backgroundColor = UIColorFromRGB(0xfffefa);
    baseLayoutTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT)];
    baseLayoutTableView.tag = 1000;
    baseLayoutTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    baseLayoutTableView.backgroundColor = [UIColor clearColor];
    baseLayoutTableView.dataSource = self;
    baseLayoutTableView.delegate = self;
    baseLayoutTableView.showsVerticalScrollIndicator = NO;
    baseLayoutTableView.allowsSelection  = NO;
    [self.contentView addSubview:baseLayoutTableView];
    
    orderNumber = [[RTLabel alloc]initWithFrame:CGRectMake(10, 8, 150, 15)];
    orderNumber.font = [UIFont systemFontOfSize:12.0f];
    orderNumber.textAlignment = NSTextAlignmentLeft;
    orderNumber.textColor = UIColorFromRGB(0x666666);
    orderNumber.backgroundColor = [UIColor clearColor];
    [baseLayoutTableView addSubview:orderNumber];
    
    orderTime = [[RTLabel alloc]initWithFrame:CGRectMake(orderNumber.frame.origin.x+orderNumber.frame.size.width, 8, 160, 15)];
    orderTime.backgroundColor = [UIColor clearColor];
    orderTime.textColor = UIColorFromRGB(0x666666);
    orderTime.font = [UIFont systemFontOfSize:12.0f];
    orderTime.textAlignment = NSTextAlignmentLeft;
    [baseLayoutTableView addSubview:orderTime];
    
    [self initORderData];

}
-(void)iniTableViewAndOtherView
{
    if (layoutTableView) {
        [layoutTableView removeFromSuperview];
        layoutTableView = nil;
    }
    
    
    layoutTableView = [[UITableView alloc]initWithFrame:CGRectMake(10, orderNumber.frame.origin.y+orderNumber.frame.size.height+5, (UI_SCREEN_WIDTH-10*2), 425)];
    
    layoutTableView.backgroundColor = UIColorFromRGB(0xf8f8f8);
    layoutTableView.delegate =self;
    layoutTableView.dataSource = self;
    layoutTableView.layer.borderColor = UIColorFromRGB(0xd4ccc5).CGColor;
    layoutTableView.layer.borderWidth = .5f;
    layoutTableView.scrollEnabled = NO;
    layoutTableView.tag = 2000;
    [baseLayoutTableView addSubview:layoutTableView];
    
    if (!shadowView) {
        shadowView  = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"orderShadow"]];
        shadowView.frame = CGRectMake(0, layoutTableView.frame.origin.y+layoutTableView.frame.size.height-50, UI_SCREEN_WIDTH, 70);
        [baseLayoutTableView addSubview:shadowView];
    }
    shadowView.hidden = NO;
    [baseLayoutTableView sendSubviewToBack:shadowView];
     sel = @selector(paymentResult:);
    
    baseLayoutTableView.contentSize =CGSizeMake(baseLayoutTableView.frame.size.width, UI_SCREEN_HEIGHT-UI_NAVIGATION_BAR_HEIGHT);
    
    if ([orderDetailData.Status isEqualToString:@"WFK"] || ([orderDetailData.SceneID isEqualToString:@"DDQR"] && [orderDetailData.StatFK isEqualToString:@"WFK"])) {
        layoutTableView.frame = CGRectMake(10, orderNumber.frame.origin.y+orderNumber.frame.size.height+5, (UI_SCREEN_WIDTH-10*2), 520);
        shadowView.frame = CGRectMake(0, layoutTableView.frame.origin.y+layoutTableView.frame.size.height-50, UI_SCREEN_WIDTH, 70);
        baseLayoutTableView.contentSize =CGSizeMake(baseLayoutTableView.frame.size.width, UI_SCREEN_HEIGHT+80);
    }else if ([orderDetailData.Status isEqualToString:@"XPWC"] || [orderDetailData.Status isEqualToString:@"JYWC"] || [orderDetailData.Status isEqualToString:@"YFH"]) {
        layoutTableView.frame = CGRectMake(10, orderNumber.frame.origin.y+orderNumber.frame.size.height+5, (UI_SCREEN_WIDTH-10*2), 450);
        shadowView.frame = CGRectMake(0, layoutTableView.frame.origin.y+layoutTableView.frame.size.height-50, UI_SCREEN_WIDTH, 70);
        baseLayoutTableView.frame = CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT-UI_NAVIGATION_BAR_HEIGHT);
        baseLayoutTableView.contentSize =CGSizeMake(baseLayoutTableView.frame.size.width, UI_MAINSCREEN_HEIGHT-UI_NAVIGATION_BAR_HEIGHT);
    }else{
        layoutTableView.frame = CGRectMake(10, orderNumber.frame.origin.y+orderNumber.frame.size.height+5, (UI_SCREEN_WIDTH-10*2), 400);
        shadowView.frame = CGRectMake(0, layoutTableView.frame.origin.y+layoutTableView.frame.size.height-50, UI_SCREEN_WIDTH, 70);
        baseLayoutTableView.frame = CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_MAINSCREEN_HEIGHT-UI_NAVIGATION_BAR_HEIGHT);
        baseLayoutTableView.contentSize =CGSizeMake(baseLayoutTableView.frame.size.width, UI_MAINSCREEN_HEIGHT-UI_NAVIGATION_BAR_HEIGHT);
    }
}

- (UIView *)createZhifuType{
    UIView * bg = [UIView initViewRect:CGRectMake(8, 0, UI_SCREEN_WIDTH-16, 100) andBackGroudColor:[UIColor whiteColor]];
    
    NSArray * arr = @[@[@"alipayClientIcon@2x",@"支付宝客户端支付",@"推荐已安装支付宝客户端的用户使用"],
                      @[@"alipayWapIcon@2x",@"支付宝网页支付",@"推荐有支付宝账号的用户使用"]];
    
    for (int i = 0; i < 2; i++) {
        
        UIImageView * zhifuiconIV = [UIImageView initImageViewRect:CGRectMake(15,10+50*i, 30, 30) andImage:LOADIMAGE(arr[i][0]) andUserInteractionEnabled:YES];
//        zhifuiconIV.image = [UIImage imageNamed:<#(NSString *)#>];
        
        UILabel * titleLB = [UILabel initLabelText:arr[i][1] andRect:CGRectMake(width_x(zhifuiconIV)+15,11+50*i,200,14) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:14] andTextColor:UIColorFromRGB(0x1f1f1f) andTextAlignment:NSTextAlignmentLeft];
        UILabel * contentLB = [UILabel initLabelText:arr[i][2] andRect:CGRectMake(titleLB.frame.origin.x,height_y(titleLB)+3, 200, 11) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:11] andTextColor:UIColorFromRGB(0x999999) andTextAlignment:NSTextAlignmentLeft];
        
        UIButton * chooseBtn = [UIButton initButton:CGRectMake(532/2.0f,12+50*i, 25, 25) btnNorImage:LOADIMAGE(@"circleBg@2x") btnDisableBtn:LOADIMAGE(@"selectedCircleBg@2x") btnTitle:nil titleNorColor:nil titleSelectColor:nil titleFont:nil];
        if (payTypeWap) {
            if (!i) {
                chooseBtn.enabled = YES;
            }else{
                chooseBtn.enabled = NO;
            }
        }else{
            if (!i) {
                chooseBtn.enabled = NO;
            }else{
                chooseBtn.enabled = YES;
            }
        }
        chooseBtn.tag = 543210+i;
        [chooseBtn addTarget:self action:@selector(changePayType:) forControlEvents:UIControlEventTouchUpInside];
        
        
        UIView * downline = [UIView initViewRect:CGRectMake(15, 49.5, UI_SCREEN_WIDTH-16-30, 0.5) andBackGroudColor:UIColorFromRGB(0xdddddd)];
        
        [bg addSubview:zhifuiconIV];
        [bg addSubview:titleLB];
        [bg addSubview:contentLB];
        [bg addSubview:chooseBtn];
        [bg addSubview:downline];
    }
    
    
    return bg;
}

#pragma mark - 选择支付方式
- (void)changePayType:(UIButton *)sender{
    if (sender.tag == 543210) {
        payTypeWap = NO;
        sender.enabled = NO;
        UIButton * btn = (UIButton *)[payTypeView viewWithTag:543211];
        btn.enabled = YES;
    }else{
        payTypeWap = YES;
        sender.enabled = NO;
        UIButton * btn = (UIButton *)[payTypeView viewWithTag:543210];
        btn.enabled = YES;
    }
}


#pragma mark ======UITbaleViewDelegate =======
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (tableView.tag == 1000) {
        return  1;
    }else{
        return   4;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellid = @"cellid";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
    
    if (!cell) {
       cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
    }
    
if (tableView.tag == 2000) {
    switch (indexPath.row) {
        case 0:{

            UIImageView *leftUpimage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ordernote"]];
            leftUpimage.frame = CGRectMake(10, 10, 17, 17);
            [cell.contentView addSubview:leftUpimage];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
//未付款
          if ([orderDetailData.Status isEqualToString:@"WFK"]) {

                RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
                [orderTittle setText:@"未付款订单"];
                [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                orderTittle.textAlignment = RTTextAlignmentCenter;
                orderTittle.font = [UIFont systemFontOfSize:17.0f];
                [cell.contentView  addSubview:orderTittle];
                
                RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28)];
                lineOneText.textColor = UIColorFromRGB(0x999999);
                [lineOneText setText:[NSString stringWithFormat:@"拍摄时间:%@",orderDetailData.ShootDate]];
                lineOneText.textAlignment = RTTextAlignmentCenter;
                [cell.contentView  addSubview:lineOneText];
                
                RTLabel *lineTwoText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, lineOneText.frame.origin.y+lineOneText.frame.size.height, 190, 28)];
                lineTwoText.textColor = UIColorFromRGB(0x999999);
                [lineTwoText setText:[NSString stringWithFormat:@"<font color=#999999>应付金额：</font><font color=#f26d5f>¥%@</font>",orderDetailData.price]];
                lineTwoText.textAlignment = RTTextAlignmentCenter;
                [cell.contentView  addSubview:lineTwoText];
                
                UIButton *orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
                orderButton.frame = CGRectMake((layoutTableView.frame.size.width-120)/2, lineTwoText.frame.origin.y+lineTwoText.frame.size.height, 120, 35);
                orderButton.backgroundColor = UIColorFromRGB(0xffb619);
                orderButton.layer.masksToBounds = YES;
                [orderButton setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                orderButton.tag = 1111;
              [orderButton addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                [orderButton setTitle:@"去付款" forState:UIControlStateNormal];
                orderButton.layer.cornerRadius = 16.0f;
                [cell.contentView  addSubview:orderButton];
              
              if (!payTypeView) {
                  payTypeView = [self createZhifuType];
              }
              payTypeView.frame = CGRectMake(0, height_y(orderButton), UI_SCREEN_WIDTH-20, 100);
              [cell.contentView addSubview:payTypeView];

//等待拍摄和 － 摄影师出门  － 已经取消
          }else if ([orderDetailData.Status isEqualToString:@"DDQR"]){
              RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake(0, 40, UI_SCREEN_WIDTH, 28)];
              [orderTittle setText:@"等待确认"];
              [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
              orderTittle.textAlignment = RTTextAlignmentCenter;
              orderTittle.font = [UIFont systemFontOfSize:17.0f];
              [cell.contentView  addSubview:orderTittle];
              
              
              RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake(0, orderTittle.frame.origin.y+orderTittle.frame.size.height+10, UI_SCREEN_WIDTH, 28)];
              lineOneText.textColor = UIColorFromRGB(0x999999);
              
              [lineOneText setText:[NSString stringWithFormat:@"预约成功，请耐心等待摄影师确认"]];
              lineOneText.font = [UIFont systemFontOfSize:14.0f];
              lineOneText.textColor = UIColorFromRGB(0xaaaaaa);
              
              lineOneText.textAlignment = RTTextAlignmentCenter;
              [cell.contentView  addSubview:lineOneText];
              //拍摄中
          }else if ([orderDetailData.Status isEqualToString:@"DDPS"] || [orderDetailData.Status isEqualToString:@"SYSCM"] || [orderDetailData.Status isEqualToString:@"YQX"]){
              RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 45, 190, 28)];
              [orderTittle setText:@"等待拍摄"];
              [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
              orderTittle.textAlignment = RTTextAlignmentCenter;
              orderTittle.font = [UIFont systemFontOfSize:17.0f];
              [cell.contentView  addSubview:orderTittle];

              
              RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28)];
              lineOneText.textColor = UIColorFromRGB(0x999999);
             
              if ( [orderDetailData.Status isEqualToString:@"SYSCM"]) {
                  orderTittle.hidden = YES;
                  lineOneText.frame = CGRectMake((layoutTableView.frame.size.width-220)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 220, 28);
                   [lineOneText setText:[NSString stringWithFormat:@"摄影师已出门，请耐心等待"]];
                   lineOneText.font = [UIFont systemFontOfSize:17.0f];
                  lineOneText.textColor = [UIColor blackColor];
              }else if ([orderDetailData.Status isEqualToString:@"YQX"]){
                  orderTittle.hidden = YES;
                  [lineOneText setText:[NSString stringWithFormat:@"订单已取消"]];
                  lineOneText.font = [UIFont systemFontOfSize:17.0f];
                  lineOneText.textColor = [UIColor blackColor];
              }else{
                 [lineOneText setText:[NSString stringWithFormat:@"拍摄时间:%@",orderDetailData.ShootDate]];
                  RTLabel *shootAddress = [[RTLabel alloc]initWithFrame:CGRectMake(10, height_y(lineOneText), 220, 60)];
                  shootAddress.text= [NSString stringWithFormat:@"拍摄地址:%@",orderDetailData.ShootAddr];
                  shootAddress.textAlignment = RTTextAlignmentCenter;
                  CGSize adjustSize = [shootAddress optimumSize];
                  shootAddress.textColor = UIColorFromRGB(0x999999);
                  if (![orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"]){
                      [cell.contentView addSubview:shootAddress];
                  }
                  orderTittle.frame = CGRectMake((layoutTableView.frame.size.width-190)/2, 45-20, 190, 28);
                  lineOneText.frame =CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28);
                     shootAddress.frame = CGRectMake((layoutTableView.frame.size.width-220)/2, height_y(lineOneText), 220, adjustSize.height);
                  
              }
              lineOneText.textAlignment = RTTextAlignmentCenter;
              [cell.contentView  addSubview:lineOneText];
//拍摄中
          }else if ([orderDetailData.Status isEqualToString:@"PSZ"] ){
              
              if ([orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"] && [orderDetailData.StatFK isEqualToString:@"WFK"]) {
                  
                  RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
                  [orderTittle setText:@"拍摄中"];
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:@"摄影师正在辛苦拍摄..."];
                  lineOneText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineOneText];
                  
                  RTLabel *lineTwoText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, lineOneText.frame.origin.y+lineOneText.frame.size.height, 190, 28)];
                  lineTwoText.textColor = UIColorFromRGB(0x999999);
                  [lineTwoText setText:[NSString stringWithFormat:@"<font color=#999999>应付金额：</font><font color=#f26d5f>¥%@</font>",orderDetailData.price]];
                  lineTwoText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineTwoText];
                  
                  UIButton *orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  orderButton.frame = CGRectMake((layoutTableView.frame.size.width-120)/2, height_y(lineTwoText), 120, 35);
                  orderButton.backgroundColor = UIColorFromRGB(0xffb619);
                  orderButton.layer.masksToBounds = YES;
                  [orderButton setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  orderButton.tag = 1111;
                  [orderButton addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [orderButton setTitle:@"去付款" forState:UIControlStateNormal];
                  orderButton.layer.cornerRadius = 16.0f;
                  [cell.contentView  addSubview:orderButton];
                  
                  if (!payTypeView) {
                      payTypeView = [self createZhifuType];
                  }
                  payTypeView.frame = CGRectMake(0, height_y(orderButton), UI_SCREEN_WIDTH-20, 100);
                  [cell.contentView addSubview:payTypeView];
              }else{
                  RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 45, 190, 28)];
                  [orderTittle setText:@"拍摄中"];
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:[NSString stringWithFormat:@"拍摄师正在辛苦拍摄..."]];
                  lineOneText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineOneText];
              }
              

//拍摄完成
          }else if ([orderDetailData.Status isEqualToString:@"PSWC"] ){
              
              if ([orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"] && [orderDetailData.StatFK isEqualToString:@"WFK"]) {
                  
                  RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
                  [orderTittle setText:@"拍摄完成"];
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-250)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 250, 28)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:@"摄影师将在24小时内出片供您选择"];
                  lineOneText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineOneText];
                  
                  RTLabel *lineTwoText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, lineOneText.frame.origin.y+lineOneText.frame.size.height, 190, 28)];
                  lineTwoText.textColor = UIColorFromRGB(0x999999);
                  [lineTwoText setText:[NSString stringWithFormat:@"<font color=#999999>应付金额：</font><font color=#f26d5f>¥%@</font>",orderDetailData.price]];
                  lineTwoText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineTwoText];
                  
                  UIButton *orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  orderButton.frame = CGRectMake((layoutTableView.frame.size.width-120)/2, height_y(lineTwoText), 120, 35);
                  orderButton.backgroundColor = UIColorFromRGB(0xffb619);
                  orderButton.layer.masksToBounds = YES;
                  [orderButton setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  orderButton.tag = 1111;
                  [orderButton addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [orderButton setTitle:@"去付款" forState:UIControlStateNormal];
                  orderButton.layer.cornerRadius = 16.0f;
                  [cell.contentView  addSubview:orderButton];
                  
                  if (!payTypeView) {
                      payTypeView = [self createZhifuType];
                  }
                  payTypeView.frame = CGRectMake(0, height_y(orderButton), UI_SCREEN_WIDTH-20, 100);
                  [cell.contentView addSubview:payTypeView];
              }else{
              
                  RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
                  [orderTittle setText:@"拍摄完成"];
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-240)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 240, 28)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  lineOneText.font = [UIFont systemFontOfSize:15.0f];
                  [lineOneText setText:[NSString stringWithFormat:@"摄影师将在24小时内出片供您选择"]];
                  lineOneText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineOneText];
                  
                  UIButton *orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  orderButton.frame = CGRectMake((layoutTableView.frame.size.width-120)/2, lineOneText.frame.origin.y+lineOneText.frame.size.height, 120, 35);
                  orderButton.backgroundColor = UIColorFromRGB(0xffb619);
                  orderButton.layer.masksToBounds = YES;
                  [orderButton setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  orderButton.tag = 3333;
                  [orderButton addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [orderButton setTitle:@"去评价" forState:UIControlStateNormal];
                  orderButton.layer.cornerRadius = 16.0f;
                  [cell.contentView  addSubview:orderButton];
                  
              }
//请选片
          }else if ([orderDetailData.Status isEqualToString:@"QXP"] ){
              
              
              if ([orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"] && [orderDetailData.StatFK isEqualToString:@"WFK"]) {
                  
                  RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
                  [orderTittle setText:@"拍摄完成"];
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:@"摄影师已上传底片"];
                  lineOneText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineOneText];
                  
                  RTLabel *lineTwoText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, lineOneText.frame.origin.y+lineOneText.frame.size.height, 190, 28)];
                  lineTwoText.textColor = UIColorFromRGB(0x999999);
                  [lineTwoText setText:[NSString stringWithFormat:@"<font color=#999999>应付金额：</font><font color=#f26d5f>¥%@</font>",orderDetailData.price]];
                  lineTwoText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineTwoText];
                  
                  UIButton *orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  orderButton.frame = CGRectMake((layoutTableView.frame.size.width-120)/2, height_y(lineTwoText), 120, 35);
                  orderButton.backgroundColor = UIColorFromRGB(0xffb619);
                  orderButton.layer.masksToBounds = YES;
                  [orderButton setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  orderButton.tag = 1111;
                  [orderButton addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [orderButton setTitle:@"去付款" forState:UIControlStateNormal];
                  orderButton.layer.cornerRadius = 16.0f;
                  [cell.contentView  addSubview:orderButton];
                  
                  if (!payTypeView) {
                      payTypeView = [self createZhifuType];
                  }
                  payTypeView.frame = CGRectMake(0, height_y(orderButton), UI_SCREEN_WIDTH-20, 100);
                  [cell.contentView addSubview:payTypeView];
              }else{
                  
                  RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
                  [orderTittle setText:@"拍摄完成"];
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 28)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:[NSString stringWithFormat:@"摄影师已上传底片"]];
                  lineOneText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineOneText];
                  
                  RTLabel *lineTwoText = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, lineOneText.frame.origin.y+lineOneText.frame.size.height, 190, 28)];
                  lineTwoText.textColor = UIColorFromRGB(0x999999);
                  [lineTwoText setText:[NSString stringWithFormat:@"请选择底片并填写收货地址"]];
                  lineTwoText.textAlignment = RTTextAlignmentCenter;
                  [cell.contentView  addSubview:lineTwoText];
                  
                  UIButton *orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  orderButton.frame = CGRectMake((layoutTableView.frame.size.width-120)/2, lineTwoText.frame.origin.y+lineTwoText.frame.size.height, 120, 35);
                  orderButton.backgroundColor = UIColorFromRGB(0xffb619);
                  orderButton.layer.masksToBounds = YES;
                  [orderButton setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  orderButton.tag = 4444;
                  [orderButton addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [orderButton setTitle:@"去选片" forState:UIControlStateNormal];
                  orderButton.layer.cornerRadius = 16.0f;
                  [cell.contentView  addSubview:orderButton];
                  
              }
              
//选片完成  － 待点评 － 已发货
          }else if ([orderDetailData.Status isEqualToString:@"XPWC"]|| [orderDetailData.Status isEqualToString:@"DDP"] || [orderDetailData.Status isEqualToString:@"YFH"] ){
              RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
              if ([orderDetailData.Status isEqualToString:@"DDP"]) {
                 [orderTittle setText:@"已收货"];
              }else if ([orderDetailData.Status isEqualToString:@"YFH"]){
                [orderTittle setText:@"已发货"];
              }else{
               [orderTittle setText:@"选片完成"];
              }
              
              if (![orderDetailData.Status isEqualToString:@"DDP"]) {
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake(10, orderTittle.frame.origin.y+orderTittle.frame.size.height, layoutTableView.frame.size.width-10-10, 60)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:[NSString stringWithFormat:@"工作人员将在3个工作日内处理完成并发货,请您注意查收!"]];
                  lineOneText.font = [UIFont systemFontOfSize:15.0f];
                  lineOneText.lineBreakMode = RTTextLineBreakModeWordWrapping;
                  lineOneText.textAlignment = RTTextAlignmentLeft;
                  [cell.contentView  addSubview:lineOneText];
                  
                  RTLabel *lineTwoText = [[RTLabel alloc]initWithFrame:CGRectMake(5,5, 70, 30)];
                  lineTwoText.font = [UIFont systemFontOfSize:15.0f];
                  lineTwoText.textColor = UIColorFromRGB(0x999999);
                  [lineTwoText setText:[NSString stringWithFormat:@"收货地址:"]];
                  lineTwoText.lineBreakMode = RTTextLineBreakModeWordWrapping;
                  lineTwoText.textAlignment = RTTextAlignmentLeft;
                  
                  addressText = [[RTLabel alloc]initWithFrame:CGRectMake(80,5, layoutTableView.frame.size.width-10-10-80, 60)];
                  addressText.font = [UIFont systemFontOfSize:15.0f];
                  addressText.textColor = UIColorFromRGB(0x999999);
                  addressText.text = orderDetailData.ReceiveAddr;
                  addressText.lineBreakMode = RTTextLineBreakModeWordWrapping;
                  addressText.textAlignment = RTTextAlignmentLeft;
                  
                  UIView *addressView = [[UIView alloc]init];
                  addressView.frame = CGRectMake(5, lineOneText.frame.origin.y+lineOneText.frame.size.height-10, layoutTableView.frame.size.width-10,addressText.frame.size.height-5);
                  addressView.backgroundColor = UIColorFromRGB(0xf2f0ee);
                  [addressView addSubview:addressText];
                  [addressView addSubview:lineTwoText];
                  [cell.contentView  addSubview:addressView];
                  
                  UIButton  *chankandipian = [UIButton buttonWithType:UIButtonTypeCustom];
                  chankandipian.frame = CGRectMake(10, height_y(addressView)+10, 65, 35);
                  [chankandipian setTitle:@"查看底片" forState:UIControlStateNormal];
                  chankandipian.backgroundColor =mClearColor;
                  chankandipian.titleLabel.font =[UIFont systemFontOfSize:14.0f];
                  [chankandipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  [chankandipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateNormal];
                  chankandipian.layer.masksToBounds = YES;
                  chankandipian.layer.cornerRadius = 4.0f;
                  chankandipian.tag = 5556;
                  [chankandipian addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [cell.contentView addSubview:chankandipian];

                  // 下载底片
                  UIButton  *xiazaidipian = [UIButton buttonWithType:UIButtonTypeCustom];
                  xiazaidipian.frame = CGRectMake(width_x(chankandipian)+6, height_y(addressView)+10, 65, 35);
                  [xiazaidipian setTitle:@"下载底片" forState:UIControlStateNormal];
                  xiazaidipian.backgroundColor = mClearColor;
                  [xiazaidipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  [xiazaidipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateNormal];
                  xiazaidipian.titleLabel.font =[UIFont systemFontOfSize:14.0f];
                  xiazaidipian.layer.masksToBounds = YES;
                  xiazaidipian.layer.cornerRadius = 4.0f;
                  xiazaidipian.tag = 5557;
                  [xiazaidipian addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [cell.contentView addSubview:xiazaidipian];
                  
//                  UIButton  *chakanwuliu = [UIButton buttonWithType:UIButtonTypeCustom];
//                  chakanwuliu.frame = CGRectMake(width_x(xiazaidipian)+6, height_y(addressView)+10, 65, 35);
//                  [chakanwuliu setTitle:@"查看物流" forState:UIControlStateNormal];
//                  chakanwuliu.backgroundColor = UIColorFromRGB(0xa99580);
//                  [chakanwuliu setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
//                  chakanwuliu.titleLabel.font =[UIFont systemFontOfSize:14.0f];
//                  chakanwuliu.layer.masksToBounds = YES;
//                  chakanwuliu.layer.cornerRadius = 4.0f;
//                  chakanwuliu.tag = 5558;
//                  [chakanwuliu addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
//                  [cell.contentView addSubview:chakanwuliu];
                  
                  UIButton  *querenshouhuo = [UIButton buttonWithType:UIButtonTypeCustom];
                  querenshouhuo.frame = CGRectMake(width_x(xiazaidipian)+6, height_y(addressView)+10, 65, 35);
                  [querenshouhuo setTitle:@"确认收货" forState:UIControlStateNormal];
                  querenshouhuo.backgroundColor = mClearColor;
                  [querenshouhuo setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  [querenshouhuo setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateNormal];
                  querenshouhuo.titleLabel.font =[UIFont systemFontOfSize:14.0f];
                  querenshouhuo.layer.masksToBounds = YES;
                  querenshouhuo.layer.cornerRadius = 4.0f;
                  querenshouhuo.tag = 5559;
                  [querenshouhuo addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [cell.contentView addSubview:querenshouhuo];
                  
              }else{
                  
                  [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
                  orderTittle.textAlignment = RTTextAlignmentCenter;
                  orderTittle.font = [UIFont systemFontOfSize:17.0f];
                  [cell.contentView  addSubview:orderTittle];
                  
                  RTLabel *lineOneText = [[RTLabel alloc]initWithFrame:CGRectMake(30, orderTittle.frame.origin.y+orderTittle.frame.size.height+10, layoutTableView.frame.size.width-25, 60)];
                  lineOneText.textColor = UIColorFromRGB(0x999999);
                  [lineOneText setText:[NSString stringWithFormat:@"如果相册有任何问题，可以联系客服。"]];
                  lineOneText.font = [UIFont systemFontOfSize:15.0f];
                  lineOneText.lineBreakMode = RTTextLineBreakModeWordWrapping;
                  lineOneText.textAlignment = RTTextAlignmentLeft;
                  [cell.contentView  addSubview:lineOneText];
                  
                  UIButton  *chankandipian = [UIButton buttonWithType:UIButtonTypeCustom];
                  chankandipian.frame = CGRectMake((UI_SCREEN_WIDTH-20-130)/3, height_y(lineOneText)-20, 65, 35);
                  [chankandipian setTitle:@"查看底片" forState:UIControlStateNormal];
                  chankandipian.backgroundColor = mClearColor;
                  chankandipian.titleLabel.font =[UIFont systemFontOfSize:14.0f];
                  [chankandipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  [chankandipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateNormal];
                  chankandipian.layer.masksToBounds = YES;
                  chankandipian.layer.cornerRadius = 4.0f;
  
                  chankandipian.tag = 5556;
                  [chankandipian addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [cell.contentView addSubview:chankandipian];
                  
                  UIButton  *xiazaidipian = [UIButton buttonWithType:UIButtonTypeCustom];
                  xiazaidipian.frame = CGRectMake(UI_SCREEN_WIDTH-20-(UI_SCREEN_WIDTH-20-130)/3-65, height_y(lineOneText)-20, 65, 35);
                  [xiazaidipian setTitle:@"下载底片" forState:UIControlStateNormal];
                  xiazaidipian.backgroundColor = mClearColor;
                  [xiazaidipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
                  [xiazaidipian setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateNormal];
                  xiazaidipian.titleLabel.font =[UIFont systemFontOfSize:14.0f];
//                  xiazaidipian.layer.masksToBounds = YES;
//                  xiazaidipian.layer.cornerRadius = 4.0f;
                  xiazaidipian.tag = 5557;
                  [xiazaidipian addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                  [cell.contentView addSubview:xiazaidipian];
                  
                  
                  
              }
              
//交易完成
          }else if ([orderDetailData.Status isEqualToString:@"JYWC"]){
              RTLabel *orderTittle = [[RTLabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, 10, 190, 28)];
              [orderTittle setText:@"已收货"];
              [orderTittle setTextColor:UIColorFromRGB(0x453d35)];
              orderTittle.textAlignment = RTTextAlignmentCenter;
              orderTittle.font = [UIFont systemFontOfSize:17.0f];
              [cell.contentView  addSubview:orderTittle];
              
              UILabel *lineOneText = [[UILabel alloc]initWithFrame:CGRectMake((layoutTableView.frame.size.width-190)/2, orderTittle.frame.origin.y+orderTittle.frame.size.height, 190, 40)];
              lineOneText.numberOfLines = 0;
              lineOneText.textColor = UIColorFromRGB(0x999999);
              lineOneText.font = [UIFont systemFontOfSize:15.0f];
              [lineOneText setText:[NSString stringWithFormat:@"如果相册有任何质量问题，可以联系客服"]];
              lineOneText.textAlignment = NSTextAlignmentCenter;
              [cell.contentView  addSubview:lineOneText];
              
              UIButton *callService = [UIButton buttonWithType:UIButtonTypeCustom];
              [callService setImage:[UIImage imageNamed:@"lianxikefu"] forState:UIControlStateNormal];
              callService.tag = 6666;
              [callService addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
              callService.frame = CGRectMake(77, height_y(lineOneText)+5,71+5+71, 34);
              [cell.contentView addSubview:callService];
              
              UIButton  *chankandipian = [UIButton buttonWithType:UIButtonTypeCustom];
              chankandipian.frame = CGRectMake(77, height_y(callService)+25, 71, 35);
              [chankandipian setTitle:@"查看底片" forState:UIControlStateNormal];
              chankandipian.backgroundColor = mClearColor;
              chankandipian.titleLabel.font =[UIFont systemFontOfSize:14.0f];
              [chankandipian setBackgroundImage:[UIImage imageNamed:@"grayBtn"] forState:UIControlStateHighlighted];
              [chankandipian setBackgroundImage:[UIImage imageNamed:@"grayBtn"] forState:UIControlStateNormal];
              chankandipian.layer.masksToBounds = YES;
              chankandipian.layer.cornerRadius = 4.0f;
              chankandipian.tag = 5556;
              [chankandipian addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
              [cell.contentView addSubview:chankandipian];
              
              UIButton  *xiazaidipian = [UIButton buttonWithType:UIButtonTypeCustom];
              xiazaidipian.frame = CGRectMake(width_x(chankandipian)+5, height_y(callService)+25, 71, 35);
              [xiazaidipian setTitle:@"下载底片" forState:UIControlStateNormal];
              xiazaidipian.backgroundColor = mClearColor;
              [xiazaidipian setBackgroundImage:[UIImage imageNamed:@"grayBtn"] forState:UIControlStateHighlighted];
              [xiazaidipian setBackgroundImage:[UIImage imageNamed:@"grayBtn"] forState:UIControlStateNormal];
              xiazaidipian.titleLabel.font =[UIFont systemFontOfSize:14.0f];
              xiazaidipian.layer.masksToBounds = YES;
              xiazaidipian.layer.cornerRadius = 4.0f;
              xiazaidipian.tag = 5557;
              [xiazaidipian addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
              [cell.contentView addSubview:xiazaidipian];
              

          }
            break;
        }
        case 1:{
            
            UIImageView *albumImage = [[UIImageView alloc]init];
            albumImage.frame = CGRectMake(10, 10, 60, 60);
            albumImage.backgroundColor = UIColorFromRGB(0xeaeaea);
            albumImage.layer.masksToBounds = YES;
            albumImage.layer.cornerRadius = 30;
            [albumImage sd_setImageWithURL:[NSURL URLWithString:orderDetailData.PhotoID] placeholderImage:nil];
            [cell.contentView addSubview:albumImage];
            
            RTLabel *titleLabel = [[RTLabel alloc]init];
            titleLabel.frame = CGRectMake(width_x(albumImage)+10, 16, 160, 30);
            [titleLabel setText:orderDetailData.SeriesName];
            [cell.contentView addSubview:titleLabel];
            
//            RTLabel *giveLabel = [[RTLabel alloc]init];
//            giveLabel.frame = CGRectMake(width_x(albumImage)+10, height_y(titleLabel), 160, 30);
//            if (IS_NOT_EMPTY(orderDetailData.OrderDesc)) {
//                [giveLabel setText:orderDetailData.OrderDesc];
//            }
//            
//            giveLabel.textColor = UIColorFromRGB(0x989088);
//            [cell.contentView addSubview:giveLabel];
            
            UILabel *priceLabel = [[UILabel alloc]init];
            priceLabel.frame = CGRectMake(width_x(albumImage)+10, height_y(titleLabel), 160, 30);
            [priceLabel setText:[NSString stringWithFormat:@"¥%@",orderDetailData.price]];
            priceLabel.font = [UIFont systemFontOfSize:17.0f];
            priceLabel.textColor = UIColorFromRGB(0xff8276);
            [cell.contentView addSubview:priceLabel];
            
            [priceLabel sizeToFit];
            
            RTLabel *marketPriceLabel = [[RTLabel alloc]init];
            marketPriceLabel.frame = CGRectMake(width_x(priceLabel)+10, height_y(titleLabel)+5, 80, 16);
            [marketPriceLabel setText:[NSString stringWithFormat:@"¥%@",orderDetailData.marketPrice]];
            marketPriceLabel.font = [UIFont systemFontOfSize:13.0f];
            marketPriceLabel.textColor = UIColorFromRGB(0x999999);
            [cell.contentView addSubview:marketPriceLabel];
            
            UIView * line = [UIView initViewRect:CGRectMake(marketPriceLabel.frame.origin.x-3, marketPriceLabel.frame.origin.y+6, 8*marketPriceLabel.text.length, 1) andBackGroudColor:UIColorFromRGB(0x999999)];
            [cell.contentView addSubview:line];
            
            if ([orderDetailData.SceneID isEqualToString:@"xD3F15C765FC444C48A0D1450C088D7C8x"]|| [orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"]){
                cell.selectionStyle = UITableViewCellAccessoryNone;
            }else{
                UIImageView *arrowIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_cell"]];
                arrowIcon.frame = CGRectMake(cell.contentView.frame.size.width-42, 45, 15/2.0f, 25/2.0f);
                [cell.contentView addSubview:arrowIcon];
            }
    
            break;
        }
        case 2:{
            UIImageView *albumImage = [[UIImageView alloc]init];
            albumImage.frame = CGRectMake(10, 10, 60, 60);
            albumImage.layer.masksToBounds = YES;
            albumImage.layer.cornerRadius = 30.0;
            albumImage.contentMode = UIViewContentModeScaleAspectFill;
            albumImage.image = LOADIMAGE(@"placeholderHeader@2x");
            [albumImage sd_setImageWithURL:[NSURL URLWithString:orderDetailData.EmplAvator] placeholderImage:LOADIMAGE(@"placeholderHeader@2x")];
            [cell.contentView addSubview:albumImage];
            
            UILabel *photographerName = [[UILabel alloc]init];
            photographerName.frame = CGRectMake(width_x(albumImage)+10, 10, 160, 20);
            [photographerName setText:[NSString stringWithFormat:@"%@",orderDetailData.EmplName]];
            
            [photographerName sizeToFit];
            [cell.contentView addSubview:photographerName];
            
            if ([orderDetailData.IsAuthen intValue]) {
                UIImageView * renzhengIV = [[UIImageView alloc] initWithFrame:CGRectMake(VIEW_POINT_MAX_X(photographerName), 12.5f, 14, 14)];
                renzhengIV.image = [UIImage imageNamed:@"renzheng"];
                [cell.contentView addSubview:renzhengIV];
            }
            
            RTLabel * levelLB = [[RTLabel alloc]init];
            levelLB.frame = CGRectMake(width_x(albumImage)+10, height_y(photographerName), 160, 20);
            levelLB.font = [UIFont systemFontOfSize:14];
            levelLB.textColor = UIColorFromRGB(0x666666);
            [levelLB setText:[NSString stringWithFormat:@"%@",orderDetailData.LevelName]];
            [cell.contentView addSubview:levelLB];
            
            RTLabel *commentRateLabel = [[RTLabel alloc]init];
            commentRateLabel.frame = CGRectMake(width_x(albumImage)+10, height_y(levelLB), 170, 20);
            if (orderDetailData.reviewavg.count > 0 ) {
                [commentRateLabel setText:[NSString stringWithFormat:@"<font color=#b4b4b4>%@:</font><font color=#453d35>%@</font><font color=#b4b4b4> %@:</font><font color=#453d35>%@</font><font color=#b4b4b4> %@:</font><font color=#453d35>%@</font>",@"守时",[[orderDetailData.reviewavg objectAtIndex:0] objectForKey:@"Avg"],@"沟通",[[orderDetailData.reviewavg objectAtIndex:1] objectForKey:@"Avg"],@"专业",[[orderDetailData.reviewavg objectAtIndex:2] objectForKey:@"Avg"]]];
            }
         
            commentRateLabel.font = [UIFont systemFontOfSize:14.0f];
            [cell.contentView addSubview:commentRateLabel];
            
            if ([orderDetailData.Status isEqualToString:@"WFK"] || [orderDetailData.Status isEqualToString:@"JYWC"]) {
                
                if ([orderDetailData.SceneID isEqualToString:@"xD3F15C765FC444C48A0D1450C088D7C8x"]|| [orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"]){
                    cell.selectionStyle = UITableViewCellAccessoryNone;       
                }else{
                    
                    UIImageView *arrowIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_cell"]];
                    arrowIcon.frame = CGRectMake(cell.contentView.frame.size.width-42, 34, 15/2.0f, 25/2.0f);
                    [cell.contentView addSubview:arrowIcon];
                }

            }else{
                if ([orderDetailData.SceneID isEqualToString:@"xD3F15C765FC444C48A0D1450C088D7C8x"]|| [orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"]){
                    cell.selectionStyle = UITableViewCellAccessoryNone;
                }
                UIButton *callCameraMan = [UIButton buttonWithType:UIButtonTypeCustom];
                [callCameraMan setImage:[UIImage imageNamed:@"make_call"] forState:UIControlStateNormal];
                callCameraMan.tag = 2222;
                [callCameraMan addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
                callCameraMan.frame = CGRectMake(cell.contentView.frame.size.width-10-34-25, 18, 34, 34);
                [cell.contentView addSubview:callCameraMan];
            }
            
            break;
        }
        case 3:{
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            UIButton *orderButtom = [UIButton buttonWithType:UIButtonTypeCustom];
            orderButtom.frame = CGRectMake((layoutTableView.frame.size.width-120)/2,25, 120, 35);
             [orderButtom setBackgroundImage:[UIImage imageNamed:@"pressedBg"] forState:UIControlStateHighlighted];
            RTLabel *discriptLabel = [[RTLabel alloc]init];

            discriptLabel.frame = CGRectMake((layoutTableView.frame.size.width-280)/2, height_y(orderButtom)+15, 280, 30);
            if ([orderDetailData.Status isEqualToString:@"WFK"] || [orderDetailData.Status isEqualToString:@"DDPS"] || [orderDetailData.Status isEqualToString:@"DDQR"]) {
                orderButtom.backgroundColor = UIColorFromRGB(0xdbdbdb);
                [orderButtom setTitle:@"取消订单" forState:UIControlStateNormal];
                orderButtom.tag = 7777;
                 [discriptLabel setText:@"<font color=#c8c8c8>预约时间内3小时取消，将扣除100元交通费</font>"];
                if ([orderDetailData.Status isEqualToString:@"SYSCM"]){
                    orderButtom.hidden = YES;
                    discriptLabel.hidden = YES;
                }

              }else if ([orderDetailData.Status isEqualToString:@"YQX"] ){
                orderButtom.backgroundColor = UIColorFromRGB(0xffb619);
                [orderButtom setTitle:@"再次预约" forState:UIControlStateNormal];
               
                orderButtom.tag = 8888;
                if ([orderDetailData.SceneID isEqualToString:@"xD3F15C765FC444C48A0D1450C088D7C8x"]|| [orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"]){
                    orderButtom.hidden = YES;
                }
//                [discriptLabel setText:@"<font color=#c8c8c8>预约一小时内取消，将扣去50块交通费</font>"];
            }else if ([orderDetailData.Status isEqualToString:@"PSWC"] || [orderDetailData.Status isEqualToString:@"PSZ"] || [orderDetailData.Status isEqualToString:@"SYSCM"]){
                
            }else{
                orderButtom.backgroundColor = UIColorFromRGB(0xffb619);
                [orderButtom setTitle:@"去评价" forState:UIControlStateNormal];
                orderButtom.tag = 3333;
            }
            [orderButtom addTarget:self action:@selector(orderHeaderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
            orderButtom.layer.masksToBounds = YES;
            orderButtom.layer.cornerRadius = 16.0f;
            [cell.contentView  addSubview:orderButtom];
            
            discriptLabel.textAlignment = RTTextAlignmentCenter;
            discriptLabel.font = [UIFont systemFontOfSize:14.0f];
            if (![orderDetailData.Status isEqualToString:@"DDQR"]) {
                [cell.contentView addSubview:discriptLabel];
            }
            
            break;
        }
            case 4:
        {
            cell = nil;
        }
        default:
            break;
    }
}
    
    cell.backgroundColor = [UIColor clearColor];
    return cell;
}



- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView.tag == 2000) {
    
    switch (indexPath.row) {
        case 0:{
            if  ([orderDetailData.Status isEqualToString:@"XPWC"] ) {
                return 200.0f;
            }else if  ([orderDetailData.Status isEqualToString:@"WFK"] || [orderDetailData.StatFK isEqualToString:@"WFK"]) {
                return 240;
            }else if ([orderDetailData.Status isEqualToString:@"JYWC"]||[orderDetailData.Status isEqualToString:@"YFH"]){
                return 200;
            }
            return  140.0f;
            break;
        }
        case 1:{
            return  80;
            break;
        }
        case 2:{
            return  80;
            break;
        }
        case 3:{
//             if ([orderDetailData.Status isEqualToString:@"PSWC"] || [orderDetailData.Status isEqualToString:@"PSWC"]){
//                 return  20;
//             }else{
                return  125;
//             }
            
            break;
        }
        default:
            break;
    }
}else{
    return  UI_SCREEN_HEIGHT+100;
}
    return  100.0f;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([orderDetailData.SceneID isEqualToString:@"xD3F15C765FC444C48A0D1450C088D7C8x"]
        ||[orderDetailData.SceneID isEqualToString:@"x9A71C3042DBC40BA8FCF0CECD49F97DFx"]){
        return;
    }
    
    if (tableView.tag == 2000) {
        
    
        [tableView performSelector:@selector(deselectRowAtIndexPath:animated:) withObject:indexPath afterDelay:.5];
        
        if (indexPath.row == 1){
            [self yuYueAgain];
            return;
        }else if (indexPath.row == 2) {
            CameraManDetailViewController *photoGrapher = [[CameraManDetailViewController alloc]init];
            photoGrapher.cameraManID = orderDetailData.EmplID;
            if ([orderDetailData.IsAuthen intValue]) {
                photoGrapher.isRenZheng = YES;
            }else{
                photoGrapher.isRenZheng = NO;
            }
            photoGrapher.type = 1;
            [self.navigationController pushViewController:photoGrapher animated:YES];
        }
        
        
        
        
    
    }
}



////////////去支付
//通过客户端
-(void)payByKeHuDuan{
    
    BOOL yy =  [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"alipay://"]];
    
    if (!yy) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"支付提示" message:@"安装支付宝客户端后才能支付" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        
        [alert show];
        
        return;
    }
    
    NSString *appScheme = @"com.xindao.meishimeike";
    NSString* orderInfo = [self getOrderInfo];
    NSString* signedStr = [self doRsa:orderInfo];
    
    NSString *orderString = [NSString stringWithFormat:@"%@&sign=\"%@\"&sign_type=\"%@\"",
                             orderInfo, signedStr, @"RSA"];
    NSLog(@"orderString:%@",orderString);
    
    [AlixLibService payOrder:orderString AndScheme:appScheme seletor:sel target:self];
    
}


//通过网页支付
-(void)payByWeb
{
    NSString * str0 = [NSString stringWithFormat:@"http://www.meike365.cn/index.php?m=Api&c=WapAlipay&a=doalipay&out_trade_no=%@&subject=%@&total_fee=%@",_orderID,[XDTools sharedXDTools].taocanName,orderDetailData.price];
    NSString * payURL = [str0 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *malongUrl = [NSURL URLWithString:payURL];
    
    PayByBagViewController *payVC = [[PayByBagViewController alloc] init];
    payVC.webUrl = malongUrl;
    [self.navigationController pushViewController:payVC animated:YES];
    
}

//支付宝回调
-(void)paymentResultDelegate:(NSString *)result{
    
}

-(void)paymentResult:(NSString *)result{
    
}
-(NSString*)getOrderInfo
{
    self.goodsName = orderDetailData.SeriesName;
    
    //拼接商品信息
    AlixPayOrder *order = [[AlixPayOrder alloc] init];
    order.partner = PartnerID;
    order.seller = SellerID;
    
    order.productName = self.goodsName;
    order.tradeNO = self.orderID;  //订单ID（由商家自行制定）
    order.productDescription = @"专业的摄影";
    order.amount = orderDetailData.price; //商品价格
    
    //测试的
//    order.amount = @"0.01";

//    order.notifyURL = @"http://123.57.16.119/index.php?m=Api&c=Order&a=notify&code=alipay"; //回调URL
    order.notifyURL = @"http://www.meike365.cn/call_back.php";

    
	return [order description];
}

-(NSString*)doRsa:(NSString*)orderInfo
{
    id<DataSigner> signer;
    signer = CreateRSADataSigner(PartnerPrivKey);
    NSString *signedString = [signer signString:orderInfo];
    return signedString;
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

//初始化 订单数据
-(void)initORderData
{
     if(![XDTools NetworkReachable]){
           [XDTools showTips:brokenNetwork toView:self.contentView];
           return;
    }
    NSDictionary *requestDictinary = @{@"OrderID": [NSString stringWithFormat:@"%@",self.orderID]};
    ASIHTTPRequest *request = [XDTools postRequestWithDict:requestDictinary API:API_CUSTOMER_ORDER_DETAILL];
       __weak ASIHTTPRequest * mrequest = request;
      [request setCompletionBlock:^{
          [XDTools hideProgress:self.contentView];
            NSDictionary *resultDic = [XDTools JSonFromString:[mrequest responseString]];
            DDLOG(@"res....%@",resultDic);
            if ([[resultDic objectForKey:@"status"] intValue]==1) {
                orderDetailData = [[orderDetailModel alloc]initWithDictionary:[resultDic objectForKey:@"data"]];
                NSString *numberStr = [NSString stringWithFormat:@"订单号:%@",orderDetailData.OrderCode];
                NSString *orderNumStr = [NSString stringWithFormat:@"下单时间:%@",orderDetailData.CreateTime];
                [orderNumber setText:numberStr];
                [orderTime setText:orderNumStr];
                
                
//                if (isCancelOrderReloadData) {
//                    [layoutTableView reloadData];
//                }else{
                [layoutTableView removeFromSuperview];

                  [self iniTableViewAndOtherView];
//                }
                
                
                
             }else{
                [XDTools showTips:[resultDic objectForKey:@"msg"] toView:self.contentView];
            }
        }];
     [request setFailedBlock:^{
            [XDTools hideProgress:self.contentView];
           if (mrequest.error.code == 2) {
                [XDTools showTips:@"网络请求超时" toView:self.view];
           }
       }];
     [request setTimeOutSeconds:12];
     [request startAsynchronous];
    [XDTools showProgress:self.contentView];
}

//订单按钮的点击事件
-(void)orderHeaderButtonPressed:(id)sender
{
    UIButton *senderButton = (UIButton *)sender;
    if (senderButton.tag == 1111) {//未付款去付款
        if (payTypeWap) {
            [self payByWeb];
        }else{
            [self payByKeHuDuan];
        }
    }else if (senderButton.tag == 2222){//拨打摄影师的电话
        if (IS_NOT_EMPTY(orderDetailData.Mobile)) {
            telprompt(orderDetailData.Mobile);
        }
    }else if (senderButton.tag == 3333){//拍摄完去评价
        EditCommentViewController *toComment = [[EditCommentViewController alloc]init];
        
        toComment.orderId = self.orderID;
        [self.navigationController pushViewController:toComment animated:YES];
    }else if (senderButton.tag == 4444){//拍摄完去选片
        ChooseImageRootViewController *chooseImage = [[ChooseImageRootViewController alloc]init];
        chooseImage.orderID = _orderID;
        [self.navigationController pushViewController:chooseImage animated:YES];
    }else if (senderButton.tag == 5555){//选片完成
        
    }else if (senderButton.tag == 5556){//选片完成－查看底片
        ChooseImageRootViewController *chooseDiImage = [[ChooseImageRootViewController alloc]init];
//        chooseDiImage.needChooseBase = NO;
        chooseDiImage.orderID = self.orderID;
        [self.navigationController pushViewController:chooseDiImage animated:YES];

    }else if (senderButton.tag == 5557){//选片完成－下载底片
        DownLoadViewController * dvc = [[DownLoadViewController alloc] init];
        dvc.orderID = self.orderID;
        dvc.PhotoPwd = orderDetailData.PhotoPwd;
        dvc.PhotoUrl = orderDetailData.PhotoUrl;

        // 判断
        if (dvc.PhotoUrl.length == 0) {
            [XDTools showTips:@"处理中，请耐心等待" toView:self.view];
            return;
        }

        [self.navigationController pushViewController:dvc animated:YES];
        
    }else if (senderButton.tag == 5558){//选片完成－查看物流
        WuLiuViewController *wuliu = [[WuLiuViewController alloc]init];
        wuliu.orderCode= orderDetailData.OrderCode;
        wuliu.orderID = self.orderID;
        wuliu.cameraManName = orderDetailData.EmplName;
        [self.navigationController pushViewController:wuliu animated:YES];
    }else if (senderButton.tag == 5559){//选片完成－确认收货
        UIAlertView *comfirmReceive = [[UIAlertView alloc]initWithTitle:nil message:@"是否确认收货？" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        comfirmReceive.tag = 202;
        [comfirmReceive show];
    }else if (senderButton.tag == 6666){//拨打客服电话
       telprompt([NSString stringWithFormat:@"4008186060"]);
    }else if (senderButton.tag == 7777){//取消订单
        NSString *tipsString ;
        if ([self calculateTimeIsInThreeHours:[orderDetailData.ShootDateType integerValue]]) {
            tipsString = @"预约时间内3小时取消，将扣除100元交通费";
        }else{
            tipsString = @"您确定要取消该订单吗?";
        }
        UIAlertView *cancelAlertView = [[UIAlertView alloc]initWithTitle:nil message:tipsString delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        cancelAlertView.tag= 101;
        [cancelAlertView show];
    }else if (senderButton.tag == 8888){//再次预约
        [self yuYueAgain];
//        [self goToTaoCanDetail];
    }
    
}

#pragma mark
#pragma mark=========再次预约
-(void)yuYueAgain
{
    if(ARRAY_IS_NOT_EMPTY(orderDetailData.reviewavg)){
        [XDTools sharedXDTools].emplZhuanYe = [[orderDetailData.reviewavg firstObject] valueForKey:@"Avg"];
        [XDTools sharedXDTools].emplGouTong = [[orderDetailData.reviewavg objectAtIndex:1] valueForKey:@"Avg"];
        [XDTools sharedXDTools].emplShoushi = [[orderDetailData.reviewavg lastObject] valueForKey:@"Avg"];
        
    }else{
        [XDTools sharedXDTools].emplZhuanYe = nil;
        [XDTools sharedXDTools].emplGouTong =nil;
        [XDTools sharedXDTools].emplShoushi =nil;
        
    }
    
    [XDTools sharedXDTools].emplImgUrl = orderDetailData.EmplAvator;
    [XDTools sharedXDTools].emplLevel = orderDetailData.LevelName;
    [XDTools sharedXDTools].emplName = orderDetailData.EmplName;
    
    [XDTools sharedXDTools].EmplID = orderDetailData.EmplID;
    
    
    
    ChooseTaoCanViewController * chooseVC = [[ChooseTaoCanViewController alloc] init];
    
    [self.navigationController pushViewController:chooseVC animated:YES];
    
}

#pragma mark
#pragma mark 取消订单
-(void)cancelOrder
{
    if(![XDTools NetworkReachable]){
        [XDTools showTips:brokenNetwork toView:self.contentView];
        return;
    }
    NSDictionary *requestDictinary = @{@"OrderID": [NSString stringWithFormat:@"%@",self.orderID]};
    ASIHTTPRequest *request = [XDTools postRequestWithDict:requestDictinary API:API_cancelOrder];
    __weak ASIHTTPRequest * mrequest = request;
    [request setCompletionBlock:^{
        NSDictionary *resultDic = [XDTools JSonFromString:[mrequest responseString]];
        DDLOG(@"res....%@",resultDic);
        if ([[resultDic objectForKey:@"status"] intValue]==1) {
            [XDTools showTips:[resultDic objectForKey:@"msg"] toView:self.contentView];
            [self refreshOrderStatus];
        }else{
            [XDTools showTips:[resultDic objectForKey:@"msg"] toView:self.contentView];
        }
    }];
    [request setFailedBlock:^{
        [XDTools hideProgress:self.contentView];
        if (mrequest.error.code == 2) {
            [XDTools showTips:@"网络请求超时" toView:self.view];
        }
    }];
    [request startAsynchronous];
}

#pragma mark 确认收货
-(void)confirmOrderReceive
{
    if(![XDTools NetworkReachable]){
        [XDTools showTips:brokenNetwork toView:self.contentView];
        return;
    }
    NSDictionary *requestDictinary = @{@"OrderID": [NSString stringWithFormat:@"%@",self.orderID]};
    ASIHTTPRequest *request = [XDTools postRequestWithDict:requestDictinary API:API_CONFIRMORDER_RECEIVED];
    __weak ASIHTTPRequest * mrequest = request;
    [request setCompletionBlock:^{
        NSDictionary *resultDic = [XDTools JSonFromString:[mrequest responseString]];
        DDLOG(@"res....%@",resultDic);
        if ([[resultDic objectForKey:@"status"] intValue]==1) {
            [XDTools showTips:[resultDic objectForKey:@"msg"] toView:self.contentView];
            [self initORderData];
//            for (int i = 5556; i < 5560; i++) {
//                UIButton * btn = (UIButton *)[self.view viewWithTag:i];
//                btn.hidden= YES;
//            }
            [layoutTableView removeFromSuperview];
            layoutTableView = nil;
            
            [[NSUserDefaults standardUserDefaults]setObject:@"isBackToOrderListToRefresh" forKey:@"1"];
        }else{
            [XDTools showTips:[resultDic objectForKey:@"msg"] toView:self.contentView];
        }
    }];
    [request setFailedBlock:^{
        [XDTools hideProgress:self.contentView];
        if (mrequest.error.code == 2) {
            [XDTools showTips:@"网络请求超时" toView:self.view];
        }
    }];
    [request startAsynchronous];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

    if (alertView.tag  == 101) {
        if (buttonIndex == 1) {
            [self cancelOrder];
        }
    }else if (alertView.tag  == 202){
        if (buttonIndex == 1) {
            [self confirmOrderReceive];
        }
    }
}
#pragma mark  == 计算是否间隔  3个小时
-(BOOL)calculateTimeIsInThreeHours:(int)timeStamp{
    
   NSTimeInterval nowStamp =  [[NSDate date]timeIntervalSince1970];
    if (timeStamp > nowStamp) {
        double timeDistance = timeStamp - nowStamp;
        if (timeDistance/3600<=3) {
            return  YES;
        }

    }
    return  NO;
}

//刷新订单状态
-(void)refreshOrderStatus
{
    [layoutTableView removeFromSuperview];
    layoutTableView = nil;
    shadowView.hidden = YES;
    [self initORderData];
    [[NSUserDefaults standardUserDefaults]setObject:@"isBackToOrderListToRefresh" forKey:@"1"];
}
//去选套餐
-(void)goToTaoCanDetail
{
    TaoCanDetailViewController *taocanDetail = [[TaoCanDetailViewController alloc]init];
    taocanDetail.SeriesID = orderDetailData.SeriesID;
    taocanDetail.SceneID =orderDetailData.SceneID;
    taocanDetail.EmplID = orderDetailData.EmplID;
    taocanDetail.SeriesName = orderDetailData.SeriesName;
    taocanDetail.sceneName = orderDetailData.SceneName;
    taocanDetail.type = 1;
    [self.navigationController pushViewController:taocanDetail animated:YES];
}

-(void)backPrePage
{
    [XDTools sharedXDTools].orderDetailVC = nil;
    [self.navigationController popViewControllerAnimated:YES];
}

@end
